
import java.util.*;
class Shape{
     public	 double PI=3.14;
	 public double getPerimeter(){
            return 0;
	}
	public double getArea(){
		return 0;
	}
	public double sumAllArea(Shape[] shape){
		double sum=0;
		for (int i = 0; i < shape.length; i++) {
			sum+=shape[i].getArea();
		}
		return sum;
	}
	public double sumAllPerimeter(Shape[] shape){
		double sum=0;
		for (int i = 0; i < shape.length; i++) {
			sum+=shape[i].getPerimeter();
		}
		return sum;
	}
	
}
class Rectangle1 extends Shape{
	private int width;
	private int length;
	public Rectangle1(int width,int length){
		this.width =width;
		this.length=length;
	}
	
	@Override
	public String toString() {
		return "Rectangle [width=" + width + ", length=" + length + "]";
	}
	public double getPerimeter(){
		return 2*(width+length);
	}
	public double getArea(){
		return width*length;
	}
}
class Circle1 extends Shape{
	private int radius;
	public Circle1(int radius){
          this.radius=radius;
	}
	@Override
	public String toString() {
		return "Circle [radius=" + radius + "]";
	}
	public double getPerimeter(){
		return 2*this.radius*PI;
	}
	public double getArea(){
		return PI*this.radius*this.radius;
	}
	
}

public class Shape_inherit  {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(in.hasNext()){
			int n=in.nextInt();
			Shape[] shape=new Shape[n];
			for(int i=0;i<shape.length;i++){
				String str=in.next();
				if(str.equals("rect")){
					shape[i]=new Rectangle1(in.nextInt(), in.nextInt());
				}
				else if(str.equals("cir")){
					shape[i]=new Circle1(in.nextInt());
				}
			}
			System.out.println(new Shape().sumAllPerimeter(shape));
			System.out.println(new Shape().sumAllArea(shape));
			System.out.println(Arrays.toString(shape));
			for (int i = 0; i < shape.length; i++) {
				System.out.println(shape[i].getClass()+","+shape[i].getClass().getSuperclass());
				}
		}
	   in.close();		
	}
}
